<?php
/**
* Utility class for GPCB behaviors
* @package GPCB
* @author caballeroantonio
* @website http://caballeroantonio.com
* @email caballeroantonio@hotmail.com
* @copyright Copyright (C) 2014. All Rights Reserved
* @license Creative Commons Attribution-NoDerivatives 4.0 International License
**/

defined('JPATH_PLATFORM') or die;

abstract class JHtmlTX
{
	/**
	 * Array containing information for loaded files
	 *
	 * @var    array
	 * @since  1.0
	 */
	protected static $loaded = array();

	public static function multiselect()
	{
		if (isset(self::$loaded[__METHOD__]))
		{
			return;
		}
		$doc = JFactory::getDocument();
		$doc->addScript('resources/kingadmin-v1.2-combined-css-tx/assets/js/bootstrap-multiselect.js');
		//parte de king-common.js y king-chart-stat.js
		self::$loaded[__METHOD__] = true;
	}
	
	public static function dataTables()
	{
		if (isset(self::$loaded[__METHOD__]))
		{
			return;
		}
		$doc = JFactory::getDocument();
		$doc->addScript('resources/kingadmin-v1.2-combined-css-tx/assets/js/datatable/jquery.dataTables.min.js');
		$doc->addScript('resources/kingadmin-v1.2-combined-css-tx/assets/js/datatable/jquery.dataTables.bootstrap.js');
		$doc->addOnReadyScript(
'
    $(".datatable").length > 0 && $(".datatable").dataTable({
        sDom: "<\'row\'<\'col-md-6\'l><\'col-md-6\'f>r>t<\'row\'<\'col-md-6\'i><\'col-md-6\'p>>",
        sPaginationType: "bootstrap",
        oLanguage: {
            sLengthMenu: "_MENU_ records per page"
        }
    });
'
							   );
		self::$loaded[__METHOD__] = true;
	}
	
	public static function flot()
	{
		if (isset(self::$loaded[__METHOD__]))
		{
			return;
		}
		$doc = JFactory::getDocument();
		$doc->addScript('resources/kingadmin-v1.2-combined-css-tx/assets/js/stat/flot/jquery.flot.min.js');
		$doc->addScript('resources/kingadmin-v1.2-combined-css-tx/assets/js/stat/flot/jquery.flot.resize.min.js');
		$doc->addScript('resources/kingadmin-v1.2-combined-css-tx/assets/js/stat/flot/jquery.flot.time.min.js');
		$doc->addScript('resources/kingadmin-v1.2-combined-css-tx/assets/js/stat/flot/jquery.flot.pie.min.js');
		$doc->addScript('resources/kingadmin-v1.2-combined-css-tx/assets/js/stat/flot/jquery.flot.tooltip.min.js');

		self::$loaded[__METHOD__] = true;
	}
	
	public static function mapael()
	{
		if (isset(self::$loaded[__METHOD__]))
		{
			return;
		}
		$doc = JFactory::getDocument();
		$doc->addScript('resources/kingadmin-v1.2-combined-css-tx/assets/js/raphael-2.1.0.min.js');
		$doc->addScript('resources/kingadmin-v1.2-combined-css-tx/assets/js/jquery.mapael.js');
		$doc->addScript('resources/kingadmin-v1.2-combined-css-tx/assets/js/maps/usa_states.js');

		self::$loaded[__METHOD__] = true;
	}
}
